package appinventor.ai_Ryan489.BBYM;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;

public class VmoCoverage extends Activity
{
   public void onCreate(Bundle icicle)
   {
      super.onCreate(icicle);
      WebView mWebView;
      // Adds Progrss bar Support
      this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
      setContentView(R.layout.main );
       
      // Makes Progress bar Visible
      getWindow().setFeatureInt( Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);

      setContentView(R.layout.sprintcoverage);
      mWebView = (WebView) findViewById(R.id.webviewsprintcov);
	    mWebView.getSettings().setJavaScriptEnabled(true);
	    mWebView.getSettings().setSupportZoom(true);
	    mWebView.loadUrl("http://www.virginmobileusa.com/check-cell-phone-coverage");
	    
	    // Sets the Chrome Client, and defines the onProgressChanged
	 // This makes the Progress bar be updated.
	 final Activity MyActivity = this;
	 mWebView.setWebChromeClient(new WebChromeClient() {
	  public void onProgressChanged(WebView view, int progress)   
	  {
	   //Make the bar disappear after URL is loaded, and changes string to Loading...
	   MyActivity.setTitle("Loading...");
	   MyActivity.setProgress(progress * 100); //Make the bar disappear after URL is loaded
	  
	   // Return the app name after finish loading
	      if(progress == 100)
	         MyActivity.setTitle(R.string.app_name);
	    }
	  });

   }
}